[//
    async function( kuo,Context,context){
        Context.headers["content-type"] = 'application/json;charset=UTF-8';
        let $THIS =  this;
        let $features = await Kuoplus(kuo.class);
        let $LANG = this.LANG();
        let $DATA = Object.assign({},this.$DATA);
        let $_POST = kuo.post;
        let $_GET = kuo.get;
        let $mailbox  =  $_POST['mailbox']?$_POST['mailbox']: "";
        let $password =  $_POST['password'] ?$_POST['password']:"";
        let $code     =  ""+($_POST['code'] ?$_POST['code']:"");
        let $USER = null;
        let $Security = await Mem.Get("session/"+kuo.sessionid);
        let $codeoff  = 0; //验证码开关
        let $chauid = 0; //用户id
        let $KJBIAO = "REG"; //标记是否是快捷注册
        if($Security && $Security["uid"]){
            $chauid = $Security["uid"];
        }
        if(!$Security ){
            $Security={
                uid:0,
                code:0,
                tuid:0
            };
        }
        if($chauid > 0){
            $USER = await Uid( $chauid );
            if(!$USER || $USER['accountoff'] != 1){
                $DATA.code = -1;
                $DATA.msg = $LANG.accountoff;
                Context.body = JSON.stringify($DATA);
                return ;
            }
            $USER['avatar'] = pichttp($USER['avatar']==""?"Tpl/login/avatar/"+($USER['id']%10)+".png":$USER['avatar']);
            $DATA.code = 1;
            $DATA.data = $USER;
            $DATA.apptoken = kuo.sessionid;
            $DATA.msg = $LANG.login_true;
            Context.body =JSON.stringify($DATA);
            return ;
        }

        if(!$THIS.Ismail($mailbox) ){
            $DATA.code = -1;
            $DATA.msg = $LANG.mailbox_error;
            Context.body = JSON.stringify($DATA);
            return ;
        }

        if(strlen($password ) < 6 || strlen($password ) > 64){
            $DATA.code = -1;
            $DATA.msg = $LANG.password_error;
            Context.body = JSON.stringify($DATA);
            return ;
        }

        if($features['configure']['mailbox验证码'] && $features['configure']['mailbox验证码']['0']){
            $codeoff = $features['configure']['mailbox验证码']['0'];
        }

        if($codeoff > 0){
            if( $code =='' || !$Security || $code != $Security['code']){
                $DATA.code = -1;
                $DATA.msg = $LANG.vcode_error;
                Context.body = JSON.stringify($DATA);
                return ;
            }
        }
        let ipci = await Mem.Get("security/"+kuo.ip);
        if( ipci > $THIS.$Securitynum){
            $DATA.code = -1;
            $DATA.msg = $LANG.mailbox_no;
            Context.body = JSON.stringify($DATA);
            return ;
        }
        let $db = await db("login_mailbox");
        let $user = await $db.Where( {'mailbox':$mailbox } ).Find();
        if(!$user){
            await Mem.Add("security/"+kuo.ip,1, $THIS.$Securitytime);
            $DATA.code = -1;
            $DATA.msg = $LANG.mailbox_no;
            Context.body = JSON.stringify($DATA);
            return ;
        }
        if( Kuomm($password) != $user['password']){
            await Mem.Add("security/"+kuo.ip,1, $THIS.$Securitytime);
            $DATA.code = -1;
            $DATA.msg = $LANG.password_no;
            Context.body = JSON.stringify($DATA);
            return ;
        }
        Mem.Del("security/"+kuo.ip);
        $USER = await Uid( $user['uid'] );
        if($USER['accountoff'] != 1){
            $DATA.code = -1;
            $DATA.msg = $LANG.accountoff;
            Context.body = JSON.stringify($DATA);
            return ;
        }
        $Security['uid'] = $user['uid'];
        await Mem.Put("session/"+kuo.sessionid,$Security,Expiredseconds);
        await  Kuolog('userlog',$user['uid'],0, $KJBIAO ,kuo.func_,kuo.class,kuo.ip);
        $USER['avatar'] = pichttp($USER['avatar']==""?"Tpl/login/avatar/"+($USER['id']%10)+".png":$USER['avatar']);
        $DATA.code = 1;
        $DATA.msg = $LANG.login_true;
        $DATA.data = $USER;
        $DATA.apptoken = kuo.sessionid;
        Context.body = JSON.stringify($DATA);
    } 
]